package com.gitee.sop.websiteserver.controller;

import com.gitee.fastmybatis.core.PageInfo;
import com.gitee.sop.websiteserver.bean.Result;
import com.gitee.sop.websiteserver.controller.param.ResourcePageParam;
import com.gitee.sop.websiteserver.controller.param.ResourceParam;
import com.gitee.sop.websiteserver.entity.Resource;
import com.gitee.sop.websiteserver.service.ResourceService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 资源信息接口
 *
 * @author admin
 */
@RestController
@RequestMapping("portal/resource")
public class ResourceController {

    @javax.annotation.Resource
    private ResourceService resourceService;

    @GetMapping("/page")
    public Result page(@Valid ResourcePageParam pageParam) {
        PageInfo<Resource> page = resourceService.page(pageParam);
        return Result.ok(page);
    }

    @PostMapping("/deleteByUuid")
    public Result deleteByUuid(@Valid ResourceParam param) {
        resourceService.delete(param.getUuid(), param.getAppId());
        return Result.ok();
    }


}
